package com.weixing.mall.pay.enums;

import com.weixing.mall.base.enums.IBaseEnum;
import lombok.NoArgsConstructor;

/**
 * 支付渠道
 *
 * @Author Small
 * @Date 2019/11/29 14:10
*/

@NoArgsConstructor
public enum PayChannelEnum implements IBaseEnum<String> {
    WX_PAY("wx",1,"微信支付"),

    ALI_PAY("ali",2,"支付宝支付");

    private String value;
    private int code;
    private String desp;


    PayChannelEnum(String value,int code, String desp) {
        this.value = value;
        this.desp = desp;
        this.code = code;
    }

    @Override
    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    @Override
    public String getDesp() {
        return desp;
    }

    public void setDesp(String desp) {
        this.desp = desp;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }


    public static PayChannelEnum getByCode(int code) {
        PayChannelEnum[] enumConstants = PayChannelEnum.class.getEnumConstants();
        for (PayChannelEnum enumObj : enumConstants) {
            if (code == enumObj.getCode()) {
                return enumObj;
            }
        }
        return null;
    }
}
